package graphics.handlers;

import graphics.TestingGraphics;
import graphics.object.interfaces.GLKeyboardListener;

import org.lwjgl.input.Keyboard;

public class GLTextFormatHandler implements GLKeyboardListener{

    public GLTextFormatHandler(){}

    public void onKeyPress(int id){
        switch(id){
        case 42:
            return;
        case 54:
            return;
        case 14:
            return;
        case 1:
            return;
        }
        if(Keyboard.isKeyDown(42) || Keyboard.isKeyDown(54)){
            switch(id){
            case 2:
            	TestingGraphics.eventManager.eventTextInput("!");
                return;
            case 3:
            	TestingGraphics.eventManager.eventTextInput("@");
                return;
            case 4:
            	TestingGraphics.eventManager.eventTextInput("#");
                return;
            case 5:
            	TestingGraphics.eventManager.eventTextInput("$");
                return;
            case 6:
            	TestingGraphics.eventManager.eventTextInput("%");
                return;
            case 7:
            	TestingGraphics.eventManager.eventTextInput("^");
                return;
            case 8:
            	TestingGraphics.eventManager.eventTextInput("&");
                return;
            case 9:
            	TestingGraphics.eventManager.eventTextInput("*");
                return;
            case 10:
            	TestingGraphics.eventManager.eventTextInput("(");
                return;
            case 11:
            	TestingGraphics.eventManager.eventTextInput(")");
                return;
            case 12:
            	TestingGraphics.eventManager.eventTextInput("_");
                return;
            case 13:
            	TestingGraphics.eventManager.eventTextInput("+");
                return;
            case 57:
            	TestingGraphics.eventManager.eventTextInput("  ");
                return;
            case 51:
            	TestingGraphics.eventManager.eventTextInput("<");
                return;
            case 52:
            	TestingGraphics.eventManager.eventTextInput(">");
                return;
            case 53:
            	TestingGraphics.eventManager.eventTextInput("?");
                return;
            case 39:
            	TestingGraphics.eventManager.eventTextInput(":");
                return;
            case 40:
                TestingGraphics.eventManager.eventTextInput("" + '"'); //lol, pro workaround for '"'. Casting is to mainstream
                return;
            case 26:
                TestingGraphics.eventManager.eventTextInput("{");
                return;
            case 27:
                TestingGraphics.eventManager.eventTextInput("}");
                return;
            case 43:
                TestingGraphics.eventManager.eventTextInput("|");
                return;
            case 41:
            	TestingGraphics.eventManager.eventTextInput("~");
            	return;
            case 28:
                TestingGraphics.eventManager.eventTextInput("\n");
                return;
            default:
                TestingGraphics.eventManager.eventTextInput(Keyboard.getKeyName(id));
                return;
            }
        }else{
            switch(id){
            case 12:
                TestingGraphics.eventManager.eventTextInput("-");
                return;
            case 13:
                TestingGraphics.eventManager.eventTextInput("=");
                return;
            case 57:
                TestingGraphics.eventManager.eventTextInput(" ");
                return;
            case 51:
                TestingGraphics.eventManager.eventTextInput(",");
                return;
            case 52:
                TestingGraphics.eventManager.eventTextInput(".");
                return;
            case 53:
                TestingGraphics.eventManager.eventTextInput("/");
                return;
            case 39:
                TestingGraphics.eventManager.eventTextInput(";");
                return;
            case 40:
                TestingGraphics.eventManager.eventTextInput("'");
                return;
            case 26:
                TestingGraphics.eventManager.eventTextInput("[");
                return;
            case 27:
                TestingGraphics.eventManager.eventTextInput("]");
                return;
            case 43:
                TestingGraphics.eventManager.eventTextInput("\\"); //Pro regex for '\'
                return;
            case 41:
            	TestingGraphics.eventManager.eventTextInput("`");
                return;
            case 28:
                return;
            default:
                TestingGraphics.eventManager.eventTextInput(Keyboard.getKeyName(id).toLowerCase());
                return;
            }
        }
    }

    public void onKeyRelease(int id) {}
}
